#pragma once

#include "../NXTBrick/NXTBrick.h"

#define VIRTUALJOYSTICK_CLASSNAME    _T("MFCVirtualJoystickCtrl")  // Window class name

// CVirtualJoystick

class CVirtualJoystick : public CWnd
{
	DECLARE_DYNAMIC(CVirtualJoystick)

public:
	CVirtualJoystick();
	virtual ~CVirtualJoystick();

	void CenterJoystick();

	void SetNxtBrick(CNXTBrick *pBrick){ m_pNxtBrick = pBrick; };

protected:
	DECLARE_MESSAGE_MAP()

	void	SetMotorsSpeed(CPoint &point);
	void	UpdateJoystick(CDC* pDC);
	CPoint	m_JoystickPosition;
	int		m_iArcSize;
	int		m_iBorderSize;
	bool	m_bJPosOutOfRadius;

	CNXTBrick	*m_pNxtBrick;

public:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	bool RegisterWindowClass(void);
	BOOL Create(CWnd* pParentWnd, const RECT& rect, UINT nID, DWORD dwStyle = WS_VISIBLE);
};


